#ifndef CTEXTEDIT_H
#define CTEXTEDIT_H

#include <QDebug>
#include <QPlainTextEdit>

class CTextEdit : public QPlainTextEdit {
    Q_OBJECT
public:
    explicit CTextEdit(QWidget *parent = nullptr);
    explicit CTextEdit(const QString &text, QWidget *parent = nullptr);
    ~CTextEdit() = default;

    void setText(const QString &text);
    QString text() const;

protected:
    bool event(QEvent *event) override;
    void focusOutEvent(QFocusEvent *event) override;

private:
    void editFinish();

signals:
    void editFinished();
    void loseFocus();
};

#endif // CTEXTEDIT_H
